<!doctype html>
<html>
  <head>
    <title>Test GC of Stopped AudioBufferSourceNode </title>
    <script src="../../resources/gc.js"></script>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <script src="../resources/audit-util.js"></script>
    <script src="../resources/audit.js"></script>
    <script src="stopped-source-test.js"></script>
  </head>
  <body>
    <script>
      let audit = Audit.createTaskRunner();

      const nodesToTest = 100;

      audit.define(
          'Test GC of Stopped AudioBufferSourceNodes', (task, should) => {
            let context = new AudioContext();
            const buffer = new AudioBuffer({
              length: 100 * RENDER_QUANTUM_FRAMES,
              sampleRate: context.sampleRate
            });
            console.log('buffer' + buffer);
            testStoppedSourceGC(task, should, {
              context: context,
              nodeName: 'AudioBufferSourceNode',
              constructorMethod: () => {
                return new AudioBufferSourceNode(context, {buffer: buffer});
              },
              numberOfNodes: 100,
            });
          });

      audit.run();
    </script>
  </body>
</html>
